using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class MedicationActualMap : EntityTypeConfiguration<MedicationActual>
	{
		public MedicationActualMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			// Table & Column Mappings
			this.ToTable("MedicationActuals");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.PersonInCharge).HasColumnName("PersonInCharge");
			this.Property(t => t.ActualTime).HasColumnName("ActualTime");
			this.Property(t => t.NoteValue).HasColumnName("NoteValue");
			this.Property(t => t.MedicationReceipId).HasColumnName("MedicationReceipId");

			// Relationships
			this.HasOptional(t => t.MedicationReceip)
				.WithMany(t => t.MedicationActuals)
				.HasForeignKey(d => d.MedicationReceipId);
				
		}
	}
}

